import { defineStore } from 'pinia';

export const useSearchStore = defineStore('SearchStore', () => {
  // 初始化搜索的参数
  const initialSearch = {
    searchTerm: '',
  };

  // 科普知识搜索参数
  const knowledgeSearch = ref({ ...initialSearch });
  // 政策法规搜索参数
  const policySearch = ref({ ...initialSearch });

  // 重置搜索参数
  function resetSearch() {
    knowledgeSearch.value = { ...initialSearch };
  }

  return {
    knowledgeSearch,
    policySearch,
    resetSearch,
  };
});
